package com.zzyl.config;

import com.aliyun.iot20180120.Client;
import com.aliyun.teaopenapi.models.Config;
import com.zzyl.properties.AliIoTConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @className: IotClientConfig
 * @description:
 * @author: InnovatorX
 * @date: 2024/6/7 21:13
 * @Version: 1.0
 */
@Configuration
public class IotClientConfig {
    @Autowired
    private AliIoTConfigProperties aliIoTConfigProperties;
    @Bean
    public Client client() throws Exception {
        Config config = new Config();
        config.setRegionId(aliIoTConfigProperties.getRegionId());
        config.setAccessKeyId(aliIoTConfigProperties.getAccessKeyId());
        config.setAccessKeySecret(aliIoTConfigProperties.getAccessKeySecret());

        return new Client(config);
    }
}
